package net.wofly.cashier.table.util;

/**
 * 餐桌状态
 *
 * @author lign
 * @version 1.0
 * @created 17-十月-2017 23:09:44
 */
public enum TableStatus {
    空闲(10, "空闲"),
    开台(20, "开台"),
    点餐(30, "点餐"),
    结帐(40, "结帐"),
    收桌(50, "收桌");
    
    private Integer value;
    private String name;
    
    private TableStatus(Integer value, String name) {
        this.value = value;
        this.name = name;
    }
    
    public static boolean isValueCorrect(Integer value) {
        for (TableStatus forEnum : values()) {
            if (value == forEnum.getValue()) {
                return true;
            }
        }
        return false;
    }
    
    public static String getName(Integer value) {
        for (TableStatus forEnum : values()) {
            if (value.equals(forEnum.getValue())) {
                return forEnum.name;
            }
        }
        return null;
    }
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public Integer getValue() {
        return value;
    }
    
    public void setValue(Integer value) {
        this.value = value;
    }
}